package com.example.demo3;

public class Ticket implements Runnable {
    private int ticket=100;

    @Override
    public void run() {
        while (true){
            if(ticket>0){
                System.out.println(Thread.currentThread().getName()+"卖了一张票，剩余:"+--ticket);
            }else{
                break;
            }
        }
    }
}
